package com.hm.demo;

import java.util.ArrayList;

public class Operator2 implements StudentOperator{
    @Override
    public void printAll(ArrayList<Student> stus) {
            for (Student student : stus) {
                System.out.println(student);
            }
    }

    @Override
    public void printAvg(ArrayList<Student> stus) {
        double sum=0;
        int count=0;
        for (Student student : stus) {
            sum+=student.getScore();
            count+=1;
        }
        System.out.println(sum/count);
    }
}
